package com.buding.fx.base.juc.smp;

import cn.hutool.core.date.DateTime;

import java.util.concurrent.Semaphore;

/**
 * 模拟限流
 */
public class SemaphoreTest {
    public static void main(String[] args) {
        Semaphore  semaphore = new Semaphore(3);
        for (int i = 0; i<10; i++){
            String orderId = "D"+i+DateTime.now().toString("yyyyMMdd");
            PayThread payThread = new PayThread(semaphore,orderId);
            payThread.run();
        }
    }
}
